Note: You are certain to want to have a copy of this file on hand when you are using MkLinux. Print it now!
This document is a very brief introduction to MkLinux in particular and Linux/UNIX in general. If you are an old hand at Linux, feel free to skim, but be sure to run setnet, as described below.
Contents
• setnet - Setting the Hostname and Networking Configuration
• Set the Hostname
• Set the Configuration for Point to Point Protocol (PPP)
• Set the Configuration for a Local Area Network (LAN)
• Setting the root password
• Adding User Accounts
• Logging in as Yourself
• Trying out some Commands
• Trying out X11
• Logging out, Rebooting, and Shutting down
• Recommended Reading
Note: Unlike MacOS, MkLinux will not interact with a user until the user has "logged in". Further, it allows different users to log in, maintaining unique sets of information for each login "session". Finally, when a user is finished with a session, s/he is responsible for "logging out", as discussed below.
setnet - Setting the Hostname and Networking Configuration
Because the installation program runs under MacOS, there are a few things it isn't able to do (or at least not easily :-). So, on your first login as root (the system administration account), MkLinux runs setnet, a hostname and network configuration script. It then logs you back out, to make sure that your next login session has all the appropriate settings. So, log in as root:
MkLinux login: root
Welcome to MkLinux for Power Macintosh!
Initially, the system has no password set for root, so it logs you in at once. It then welcomes you with a message. As an administrator, you will be able to change the text of the users' login welcome messages by editing the /etc/motd (Message Of The Day) file.
The setnet script sets the hostname and configures PPP- and/or LAN-based networking configurations. setnet runs automatically on the first root login, but it can also be run at any time by root.
Note: If you are planning to use your machine as a PPP gateway, use setnet to set up both PPP- and LAN-based networking, then configure the necessary gateway-related files by hand. Setting up both PPP and LAN networking is also useful when the computer will be attached to the two interfaces at different times (e.g, a portable).
Set the Hostname
Hostnames normally consist of 1-8 lower-case alphabetic characters [a-z] and/or digits [0-9] (e.g., penguin). Avoid alphabetic characters with accents, etc. (i.e., 8-bit characters)
Set the Configuration for Point to Point Protocol (PPP)
Do this step if your machine will be connected to the Internet via Point to Point Protocol (PPP). Before you begin, make sure you can answer the following questions:
• What is the (modem) phone number of your Internet service provider?
• What serial port does your modem use? (e.g., Printer or Modem)
• What interface speed can your modem handle? (e.g., 19200)
The interface speed will be at least the rated communication speed of your modem, but it may be far higher. The rated communication speed (e.g., 14400 or 28800 bps) indicates how many bits per second your modem can send (or receive) over the telephone line. The interface speed, in contrast, indicates how many bits per second your modem can send to (or receive from) your computer.
If your modem supports data compression, it may be able to handle many more (uncompressed) bits over the interface than it has to transmit or receive (as compressed bits) over the telephone line. In general, you should use the highest interface speed that both your computer and your modem can accept.
• What is the IP address of your Internet provider's nameserver? (e.g., 2.3.4.5)
• What sequence of queries and responses does your Internet provider require for PPP login?
This will be something like: "ogin: ", "Penguin", "ssword: ", "iB2Kul4u"
To help correct for characters which may be corrupted during the initial sequence, we advise that you use the string "ogin:", rather than "login:" and "ssword:" rather than "password:".
The script will create a program named /usr/sbin/ppp-go and a modem setup file called /etc/ppp/ppprc.cuaX, where X corresponds to the port where the modem is connected.
Set the Configuration for a Local Area Network (LAN)
Do this step if your machine will be attached to a Local Area Network (LAN). Before you begin, make sure you can answer the following questions:
• What is the name of your local domain? (e.g., penguins.com)
• What is the address of the LAN's primary nameserver (if any)? (e.g., 1.2.3.123)
• What is the Internet (IP) address for the machine? (e.g., 1.2.3.4)
• What is the Internet Broadcast address for the LAN? (e.g., 1.2.3.255)
• What is the LAN's netmask (if any)? (e.g., 255.255.255.0)
• What is the address of the LAN's Internet gateway (if any)? (e.g., 1.2.3.123)
setnet will modify certain networking configuration files, then turn on networking capability. You will now be able to run common networking commands such as ftp, ping, rlogin, and telnet.
Setting the root password
MkLinux logged you out when you finished running setnet, so you will have to log back in:
penguin login: root
...
[root@penguin /root]#
Once you are logged in, the system prints a prompt, giving certain useful information. This prompt indicates that your username is root and that you are logged into a machine named penguin. It also indicates that your current directory is /root. This is the root account's home directory, where you should put private administrative files.
Even if your computer isn't on a network, it is still vulnerable to straying fingers. If it's on a network, the fingers could stray onto your system from anywhere in the world. For safety, therefore, set a password for the root account:
[root@penguin /root]# passwd
Changing password for root
...
New password (? for help): [...silent...]
New password (again): [...silent...]
Password changed for root
[root@penguin /root]#
The password you enter is not echoed to the screen. In fact, unlike MacOS practice, UNIX doesn't even print bullets to show you how many characters you've typed. This may seem a bit awkward, but it is a valuable precaution. Someone might be looking over your shoulder at the screen or even coming when you're not around! Why give them any clues (including the number of characters) about your password?
When picking a password, use a (six or more) character string that you can remember. Avoid passwords that can be guessed easily (e.g., names, birthdays, etc.) or found in a dictionary. Some reasonable strategies are:
• including a mixture of UPPER and lower-case alphabetic characters
• including numbers and special characters
• combining words
Thus, you might create a password such as none2good, Im_D_Bo$$, or Its4sure. Note that MkLinux will not save your password, per se. Instead, it will encrypt it and save the encrypted form. Then, the next time you log in, it can encrypt your entered password and see if it matches what it has saved. This distinction is very important: a MkLinux administrator cannot find out a user's password, even by looking in the password file. S/he can only install a new password and ask the user to change it promptly.
Adding User Accounts
Initially, MkLinux has only one login account, root. The root account is very powerful; it can read (and write!) any file at all. So, unless you never make misteaks, you probably should not stay logged in as root all the time. Pick a personal username for your regular system use. In theory, your username can contain:
• lower-case letters (a-z)
• digits (0-9)
• periods (.) and underscores (_)
In practice, it's best to use only letters, avoiding ones that aren't found in English (i.e., 8-bit characters). You will be giving your username to folks around the world; pick something they can use and remember!
If at all possible, let users pick their own usernames. First names (brett) and nicknames (lion) are memorable. If there are lots of users, consider using initials (vlb) or first initials and last names (jroberts). If possible, avoid using artificial usernames (q123456).
To add a user account (create a home directory, etc.), use the adduser command, then use passwd to set an (initial, if for someone else) password:
[root@penguin /root]# adduser linus
...
[root@penguin /root]# passwd linus
Changing password for linus
...
New password (? for help): [...silent...]
New password (again): [...silent...]
Password changed for linus
[root@penguin /root]#
Logging in as Yourself
Now that you have your own account, you can try it out:
[root@penguin /root]# exit
penguin login: linus
Password: [...silent...]
...
[linus@penguin linus]$
Note that the prompt has changed in a few ways. The username is different, as is the home directory. Finally, the last character of the prompt is now a dollar sign ($), rather than a sharp sign (#). These are cues that you are no longer logged in as root. Your options in this account are more limited, but they are quite powerful enough for most purposes.
If you need more privileges, you can always log back in as root. Alternatively, you can "set user" to root, as:
[linus@penguin linus]$ su -
Password: [...silent...]
[root@penguin linus]#
...
[root@penguin linus]# exit
exit
[linus@penguin linus]$
Unlike MacOS, UNIX requires users to enter commands (e.g., adduser, exit, passwd, su). These commands may be built into the shell (command line interpreter). Alternatively, they may be pre-defined macro strings (also known as aliases or shell functions) or names of application programs.
Viewed from a distance, all shells are pretty much equivalent. They all support a common set of built-in commands and they are all able to invoke application programs. The differences between shells lie in their interactive and programming features. If you are familiar with other UNIX shells, you may find bash (the default MkLinux shell) a little peculiar. Give bash a chance; it combines the programming power of ksh with the interactive features of tcsh.
Trying out some Commands
[linus@penguin linus]$ pwd
/home/linus
The pwd command Prints the Working (current) Directory. Although the prompt lists linus as your current directory, pwd reveals the full path to be /home/linus. This is the complete name of your home directory, loosely equivalent to a MacOS name like ":penguin:home:linus".
[linus@penguin linus]$ cd /
[linus@penguin /]$ ls
bin home mach_servers root usr
dev lib mnt sbin var
etc lost+found proc tmp
The cd command lets us Change to a specified Directory. The ls command gives a minimal listing of the contents of the current directory, showing both files and directories.
[linus@penguin /]$ ls -l
total 29
drwxr-xr-x 2 root root 1024 Aug 21 10:12 bin
drwxr-xr-x 2 root root 5120 Aug 25 21:23 dev
...
The -l flag causes ls to give a very complete listing. It is similar to the MacOS View by Name, but it also shows UNIX characteristics such as file type, modes, links, owner, and group. Using other commands (e.g., chmod), you can adjust some of these characteristics (e.g., modes), allowing files to be read and/or written as you determine.
[linus@penguin /]$ cd /root
bash: /root: Permission denied
/root is the home directory of the root account. As such, it should not be accessible by ordinary users. Consequently, the system denies us permission to enter that directory. The word "root", by the way, has two separate meanings in UNIX. All files and directories in the entire file system are connected to the root directory (/, pronounced "slash"). The root account, in contrast, is the all-powerful administrative login account.
[linus@penguin /]$ cd /tmp
[linus@penguin /tmp]$ touch foo
[linus@penguin /tmp]$ ls -l foo
-rw-rw-r-- 1 linus root 0 Aug 25 21:56 foo
[linus@penguin /tmp]$ touch /foo
touch: /foo: Permission denied
The system lets us go to /tmp, and even touch (create) a file there, because /tmp is a "community work space". On the other hand, while the root directory is readable by ordinary users, it is not writable by them. So, we can't create a file (/foo) in it.
[linus@penguin /tmp]$ rm foo
[linus@penguin /tmp]$ ls -l foo
ls: foo: No such file or directory
The UNIX system, unlike MacOS, believes that users know what they are doing. If we tell UNIX to remove (rm) a file, it will do so at once (assuming, of course that we have the necessary permissions). It won't ask if we're sure, put the file into a temporary holding area (e.g., Trash), or in any other way try to protect us from the consequences of our actions. Think of UNIX commands as very sharp knives, invaluable in a kitchen, but not to be handled carelessly.
[linus@penguin /]$ cd
[linus@penguin linus]$
When used with no arguments (parameters), cd returns us to our home directory. This can be very useful if we have wandered off to some far corner of the file system.
Trying out X11
Now let's try out the X Window System, also known as X11. First, start up the X11 server for penguin:
[linus@penguin linus]$ X11
By default, MkLinux sets users up with twm (Tab Window Manager), a few xterm (X Terminal) windows, an xclock, and an xlogo. See one of the references on X (listed below) for information on customizing these and other features. In the meanwhile, here are some useful pointers on our default X implementation:
• twm is not set up as "click to type". If the cursor is over a window, that window "hears" the keyboard.
• To see an administrative "pull-down" menu, hold down the mouse button over the background.
• Use Option-2 and -3 for the "middle" and "right" buttons, respectively.
• To exit twm (but not X), use the "Exit" item at the bottom of the pull-down menu.
• To exit X, type "exit" into the CONSOLE window.
An alternate window manager, fvwm
There are many X11 window managers available. MkLinux presently includes two. You may want to try the alternative, fvwm. Start up the X11 server using the startx script.
[linus@penguin linus]$ startx
Notice that the screen, the window borders, and the icons have a different look than they had under twm. You may see a button for the Mosaic Web Browser. Mosaic is not part of the standard MkLinux distribution, due to licensing restrictions. However, you are free to download it from a variety of ftp sites, and install it on your system. A binary distribution archive for Mosaic is available on ftp://ftp.mklinux.apple.com/contrib/Non-RPMS.
To exit fvwm, use the "Exit" item at the bottom of the pull-down menu. Upon exiting, you may see an error message of the form "waiting for X server to shut down xterm: fatal IO error...". This is a harmless message caused by the X11 exit process and can be safely ignored.
If you don't care for either of these window managers, others are available on the net. Feel free to hunt around and experiment.
Logging out, Rebooting, and Shutting down
The following assumes that you are sitting at the main system display, and that you are not running X11:
• Here is how to log out, leaving MkLinux to its own devices. This is not the same as shutting down!
[linus@penguin linus]$ exit
• Here is how to reboot the system:
penguin login: root
Password: [...silent...]
[root@penguin /root]# shutdown -r now
This will kill off any running programs, shut down MkLinux, and reboot the system. At the MkLinux startup dialog, you will have a chance to specify whether you wish to restart under MacOS or MkLinux.
• Here is how to shut down the system:
penguin login: root
Password: [...silent...]
[root@penguin /root]# shutdown -h now
This will kill off any running programs and shut down MkLinux. It should also power down the computer. If for some reason the computer is not powered down, you can do this by pressing the system power switch, generally located at the back of the machine.
Recommended Reading
MkLinux is a very large system; we have barely touched on its capabilities, languages, or overall structure. Fortunately, there are quite a few books around that will show you the ropes. Here is a small sampling, to get you started...
Because Linux is not UNIX, you will need some references on Linux itself:
O’Reilly (www.ora.com):
Running Linux
Yggdrasil (www.yggdrasil.com):
The Linux Bible
Linux Internet Archives (CD-ROM set)
Because Linux is like UNIX, it wouldn't hurt to have some references on UNIX:
O’Reilly & Associates (www.ora.com):
Berkeley Software Distribution (set)
UNIX in a Nutshell
UNIX Power Tools
Prentice Hall (www.prenhall.com):
The UNIX Programming Environment
UNIX System Administration Handbook, 2nd. Ed.
You may also want some references for bash, C, Mach, Perl, the PowerPC, and the X Window System: